Skip to content

Conversation

@ashishkumar50
Copy link
Contributor

What changes were proposed in this pull request?

Currently when read fails from DN, client retries without waiting. In this PR, client will wait based on retry policy before reading again.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-10427

How was this patch tested?

Update existing test

Copy link
Contributor

@ivandika3 ivandika3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. LGTM overall.

I have some minor comments and nitpicks, which can be ignored / addressed.

throw new IOException(e);
}
return retryAction.action == RetryPolicy.RetryAction.RetryDecision.RETRY;
if (retryAction.action == RetryPolicy.RetryAction.RetryDecision.RETRY) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: It might be nice if we can have a general RetryAction handler so that we don't need to duplicate the sleeping logic (similar codes is in AbstractDataStreamOutput#shouldRetry, GrpcOmTranport#shouldRetry, and KeyOutputStream#handleRetry)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sounds good may be we can refactor in other Jira.

seekAndVerify(50);
byte[] b = new byte[200];
blockInputStreamWithRetry.read(b, 0, 200);
assertThat(logCapturer.getOutput()).contains("Retry read after");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifying debug log message is going to be brittle. But writing a test to verify time is always tricky. What I usually do is to introduce a timer class that wraps around Thread.sleep(), and we can verify the time does advance (artifically). That's going to introduce big code churn with little benefit so I'm okay with what we have now.

Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. The change is similar to what's in KeyOutputStream.

Copy link
Contributor

@ChenSammi ChenSammi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ashishkumar50 .

@ChenSammi ChenSammi merged commit 1cf9e95 into apache:HDDS-7593 Mar 4, 2024
smengcl pushed a commit to smengcl/hadoop-ozone that referenced this pull request Mar 6, 2024
chungen0126 pushed a commit to chungen0126/ozone that referenced this pull request May 3, 2024
chungen0126 pushed a commit to chungen0126/ozone that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants